package com.yangchoi.jetpackcompose.ui.widget.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.yangchoi.jetpackcompose.ui.widget.ext.onClick

@Composable
fun CommonButton(
    btnTitle:String,
    startDp:Dp = 20.dp,
    topDp:Dp = 20.dp,
    endDp: Dp = 20.dp,
    bottomDp: Dp = 20.dp,
    buttonHeight:Dp = 48.dp,
    bgColor: Color = Color.White,
    bgShapeDp: Dp = 16.dp,
    titleStyle: TextStyle = TextStyle(fontSize = 16.sp, color = Color.White),
    clickCallback:()->Unit
){
    Box(modifier = Modifier
        .padding(startDp, topDp, endDp, bottomDp)
        .fillMaxWidth()
        .height(buttonHeight)
        .background(color = bgColor, shape = RoundedCornerShape(bgShapeDp))
        .onClick {
            clickCallback.invoke()
        }
    ){
        Text(text = btnTitle, style = titleStyle, modifier = Modifier.align(Alignment.Center))
    }
}